
package com.shop.cloud.mall.api.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shop.cloud.common.core.util.R;
import com.shop.cloud.common.portal.annotation.ApiLogin;
import com.shop.cloud.mall.api.service.PointsRecordService;
import com.shop.cloud.mall.common.entity.PointsRecord;
import com.shop.cloud.common.portal.util.ThirdSessionHolder;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * 积分变动记录
 *
 * @author
 * @date 2019-12-05 19:47:22
 */
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/pointsrecord")
@Tag(description = "pointsrecord", name = "积分变动记录API")
public class PointsRecordController {

    private final PointsRecordService pointsRecordService;

    /**
     * 分页查询
     * @param page 分页对象
     * @param pointsRecord 积分变动记录
     * @return
     */
	@Operation(summary = "分页查询")
    @GetMapping("/page")
	@ApiLogin
    public R getPointsRecordPage(Page page, PointsRecord pointsRecord) {
		pointsRecord.setUserId(ThirdSessionHolder.getUserId());
        return R.ok(pointsRecordService.page(page, Wrappers.query(pointsRecord)));
    }

}
